package cn.rslee.test.util;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

import javax.sql.DataSource;

/**
 * 描述：
 * 
 * <pre>HISTORY
 * ****************************************************************************
 *  ID   DATE                    PERSON          REASON
 *  1    2016年7月11日         rslee               Create
 * ****************************************************************************
 * </pre>
 * @author rslee
 * @since 1.0
 */
public class DBHelper {
	
	private DataSource ds;

	public DBHelper(DataSource ds) {
		super();
		this.ds = ds;
	}
	
	public void execute(String sql) throws SQLException{
		Connection conn = ds.getConnection();
		Statement stmt = conn.createStatement();
		stmt.executeUpdate(sql);
		stmt.close();
		conn.close();
	}
	
	

}
